//package com.yunhe.authority.controller.data;
//
//import com.yunhe.authority.domain.authority.StationStaticData;
//import com.yunhe.authority.service.authority.StationStaticDataService;
//import com.yunhe.common.annotation.OperationRecord;
//import com.yunhe.common.constant.SystemConsts;
//import com.yunhe.common.exception.ArgumentErrorException;
//import com.yunhe.common.exception.ObjectNotFoundException;
//import com.yunhe.common.exception.UniqueConstraintsException;
//import com.yunhe.common.model.ResultObject;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.Optional;
//import java.util.OptionalLong;
//
///**
// * 电站静态数据controller
// * @author zhengbo
// * @date 2020/11/2 16:56
// */
//@Api(value = "StationStaticData", description = "电站静态数据", tags = {"Model_StationStaticData"})
//@RequestMapping("/station/staticData")
//@RestController
//public class StationStaticDataController {
//
//    @Autowired
//    private StationStaticDataService stationStaticDataService;
//
//    /**
//     * 新增电站静态数据
//     * @param stationId 电站ID
//     * @param stationStaticData 电站静态数据对象
//     */
//    @ApiOperation("新增电站静态数据")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "stationId", value = "电站ID", required = true, dataType = "long", paramType = "query")
//    })
//    @RequestMapping(method = RequestMethod.POST)
//    @OperationRecord(menu = "电站静态数据", actionType = SystemConsts.ACTION.ADD)
//    public ResponseEntity<ResultObject> post(@RequestBody StationStaticData stationStaticData,
//                                             @RequestParam("stationId") Long stationId) throws ArgumentErrorException, ObjectNotFoundException {
//
//        StationStaticData newStationStaticData = stationStaticDataService.creatStationStaticData(stationId, stationStaticData);
//        return new ResponseEntity<>(new ResultObject<>(newStationStaticData), HttpStatus.OK);
//    }
//
//    @ApiOperation("根据电站ID获得电站静态数据对象")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "stationId", value = "电站ID", required = true, dataType = "long", paramType = "path")
//    })
//    @RequestMapping(value = "/{stationId}", method = RequestMethod.GET)
//    public ResponseEntity<ResultObject> getByStationId(@PathVariable("stationId") Long stationId) {
//        StationStaticData stationStaticData = stationStaticDataService.findByStationId(stationId);
//        return new ResponseEntity<>(new ResultObject<>(stationStaticData), HttpStatus.OK);
//    }
//
//    /**
//     * 更新企业（更新全部字段）
//     * @param id
//     * @param stationStaticData
//     */
//    @ApiOperation("更新全部字段")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "long", paramType = "path"),
//            @ApiImplicitParam(name = "stationId", value = "电站ID", dataType = "long", paramType = "query")
//    })
//    @RequestMapping(value = "/{stationId}", method = RequestMethod.PUT)
//    @OperationRecord(menu = "电站静态数据", actionType = SystemConsts.ACTION.EDIT)
//    public ResponseEntity<ResultObject> put(@PathVariable("stationId") Long stationId,
//                                            @RequestParam("id") Long id,
//                                            @RequestBody StationStaticData stationStaticData)
//            throws ArgumentErrorException,  UniqueConstraintsException, ObjectNotFoundException {
//        stationStaticData.setId(id);
//        StationStaticData newStationStaticData = stationStaticDataService.updateStationStaticDataByStationId(stationId, stationStaticData);
//        return new ResponseEntity<>(new ResultObject<>(newStationStaticData), HttpStatus.OK);
//    }
//    /**
//     * 更新企业（更新指定字段）
//     * @param id 电站静态数据ID
//     * @param stationId 电站ID
//     */
//    @ApiOperation("更新指定字段")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "stationId", value = "电站ID", required = true, dataType = "Long", paramType = "path"),
//            @ApiImplicitParam(name = "area", value = "总占地面积", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "taxes", value = "年均税收", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "ssCompNum", value = "规上企业数", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "intendSsCompNum", value = "拟上规企业数", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "allOfficeNum", value = "可入驻总企业数（入驻率=入驻企业数/可入驻总企业数）", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "solvingEmployment", value = "解决就业", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "electromechanicalCompNum", value = "企业数量_机电", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "packingCompNum", value = "企业数量_包装", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "materialsCompNum", value = "企业数量_新材料", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "automotiveCompNum", value = "企业数量_汽车产品", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "foodCompNum", value = "企业数量_食品", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "otherCompNum", value = "企业数量_其他", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "industryNum", value = "行业数", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "compStarListMonth", value = "企业星级排名_月（每月的数据以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "compStarListYear", value = "企业星级排名_年（每年的数据以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "aouCompNumAbove3000", value = "年产值范围内的企业数量_3000万~5000万", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "aouCompNumAbove5000", value = "年产值范围内的企业数量_5000万~1亿", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "aouCompNumAbove10000", value = "年产值范围内的企业数量_1亿~无穷", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "mediumAlarmNum", value = "一般告警数量", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "mediumAlarmProcessingRate", value = "一般告警已解决率", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "heaviestAlarmNum", value = "严重告警数量", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "heaviestAlarmProcessingRate", value = "严重告警已解决率", dataType = "Long", paramType = "query"),
//            @ApiImplicitParam(name = "waterConsumptionDay", value = "日用水量", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "waterConsumptionMonth", value = "月用水量", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "waterConsumptionYear", value = "年用水量", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "waterConsumptionDayList", value = "日用水量曲线（每日的数据以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "waterConsumptionMonthList", value = "月用水量曲线（每月的数据以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "waterConsumptionYearList", value = "年用水量曲线（每年的数据以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "sharpElectricityDay", value = "电量_日_尖", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "peakElectricityDay", value = "电量_日_峰", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "flatElectricityDay", value = "电量_日_平", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "valleyElectricityDay", value = "电量_月_谷", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "sharpElectricityMonth", value = "电量_月_尖", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "peakElectricityMonth", value = "电量_月_峰", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "flatElectricityMonth", value = "电量_月_平", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "valleyElectricityMonth", value = "电量_年_谷", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "sharpElectricityYear", value = "电量_年_尖", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "peakElectricityYear", value = "电量_年_峰", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "flatElectricityYear", value = "电量_年_平", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "valleyElectricityYear", value = "电量_年_谷", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "smartDevicesFeesDay", value = "电费_日_智能设备", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "materialsFeesDay", value = "电费_日_新材料", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "environmentFeesDay", value = "电费_日_环保设备", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "smartDevicesFeesMonth", value = "电费_月_智能设备", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "materialsFeesMonth", value = "电费_月_新材料", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "environmentFeesMonth", value = "电费_月_环保设备", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "smartDevicesFeesYear", value = "电费_年_智能设备", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "materialsFeesYear", value = "电费_年_新材料", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "environmentFeesYear", value = "电费_年_环保设备", dataType = "Double", paramType = "query"),
//            @ApiImplicitParam(name = "alarmList", value = "告警列表（各字段间以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "loadForecastListDay", value = "日负荷预测列表（各字段间以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "loadForecastListMonth", value = "月负荷预测列表（各字段间以逗号间隔）", dataType = "String[]", paramType = "query"),
//            @ApiImplicitParam(name = "loadForecastListYear", value = "年负荷预测列表（各字段间以逗号间隔）", dataType = "String[]", paramType = "query")
//    })
//    @RequestMapping(value = "/{stationId}", method = RequestMethod.PATCH)
//    @OperationRecord(menu = "电站静态数据", actionType = SystemConsts.ACTION.EDIT)
//    public ResponseEntity<ResultObject> patch(@PathVariable("stationId") Long stationId,
//                                            @RequestParam("id") Optional<Long> id,
//                                            @RequestParam("area") Optional<Double> area,
//                                            @RequestParam("taxes") Optional<Double> taxes,
//                                            @RequestParam("ssCompNum") Optional<Long> ssCompNum,
//                                            @RequestParam("intendSsCompNum") Optional<Long> intendSsCompNum,
//                                            @RequestParam("allOfficeNum") Optional<Long> allOfficeNum,
//                                            @RequestParam("solvingEmployment") Optional<Long> solvingEmployment,
//                                            @RequestParam("electromechanicalCompNum") Optional<Long> electromechanicalCompNum,
//                                            @RequestParam("packingCompNum") Optional<Long> packingCompNum,
//                                            @RequestParam("materialsCompNum") Optional<Long> materialsCompNum,
//                                            @RequestParam("automotiveCompNum") Optional<Long> automotiveCompNum,
//                                            @RequestParam("foodCompNum") Optional<Long> foodCompNum,
//                                            @RequestParam("otherCompNum") Optional<Long> otherCompNum,
//                                            @RequestParam("industryNum") Optional<Long> industryNum,
//                                            @RequestParam("compStarListMonth") Optional<String[]> compStarListMonth,
//                                            @RequestParam("compStarListYear") Optional<String[]> compStarListYear,
//                                            @RequestParam("aouCompNumAbove3000") Optional<Double> aouCompNumAbove3000,
//                                            @RequestParam("aouCompNumAbove5000") Optional<Double> aouCompNumAbove5000,
//                                            @RequestParam("aouCompNumAbove10000") Optional<Double> aouCompNumAbove10000,
//                                            @RequestParam("mediumAlarmNum") Optional<Long> mediumAlarmNum,
//                                            @RequestParam("mediumAlarmProcessingRate") Optional<Long> mediumAlarmProcessingRate,
//                                            @RequestParam("heaviestAlarmNum") Optional<Long> heaviestAlarmNum,
//                                            @RequestParam("heaviestAlarmProcessingRate") Optional<Long> heaviestAlarmProcessingRate,
//                                            @RequestParam("waterConsumptionDay") Optional<Double> waterConsumptionDay,
//                                            @RequestParam("waterConsumptionMonth") Optional<Double> waterConsumptionMonth,
//                                            @RequestParam("waterConsumptionYear") Optional<Double> waterConsumptionYear,
//                                            @RequestParam("waterConsumptionDayList") Optional<String[]> waterConsumptionDayList,
//                                            @RequestParam("waterConsumptionMonthList") Optional<String[]> waterConsumptionMonthList,
//                                            @RequestParam("waterConsumptionYearList") Optional<String[]> waterConsumptionYearList,
//                                            @RequestParam("sharpElectricityDay") Optional<Double> sharpElectricityDay,
//                                            @RequestParam("peakElectricityDay") Optional<Double> peakElectricityDay,
//                                            @RequestParam("flatElectricityDay") Optional<Double> flatElectricityDay,
//                                            @RequestParam("valleyElectricityDay") Optional<Double> valleyElectricityDay,
//                                            @RequestParam("sharpElectricityMonth") Optional<Double> sharpElectricityMonth,
//                                            @RequestParam("peakElectricityMonth") Optional<Double> peakElectricityMonth,
//                                            @RequestParam("flatElectricityMonth") Optional<Double> flatElectricityMonth,
//                                            @RequestParam("valleyElectricityMonth") Optional<Double> valleyElectricityMonth,
//                                            @RequestParam("sharpElectricityYear") Optional<Double> sharpElectricityYear,
//                                            @RequestParam("peakElectricityYear") Optional<Double> peakElectricityYear,
//                                            @RequestParam("flatElectricityYear") Optional<Double> flatElectricityYear,
//                                            @RequestParam("valleyElectricityYear") Optional<Double> valleyElectricityYear,
//                                            @RequestParam("smartDevicesFeesDay") Optional<Double> smartDevicesFeesDay,
//                                            @RequestParam("materialsFeesDay") Optional<Double> materialsFeesDay,
//                                            @RequestParam("environmentFeesDay") Optional<Double> environmentFeesDay,
//                                            @RequestParam("smartDevicesFeesMonth") Optional<Double> smartDevicesFeesMonth,
//                                            @RequestParam("materialsFeesMonth") Optional<Double> materialsFeesMonth,
//                                            @RequestParam("environmentFeesMonth") Optional<Double> environmentFeesMonth,
//                                            @RequestParam("smartDevicesFeesYear") Optional<Double> smartDevicesFeesYear,
//                                            @RequestParam("materialsFeesYear") Optional<Double> materialsFeesYear,
//                                            @RequestParam("environmentFeesYear") Optional<Double> environmentFeesYear,
//                                            @RequestParam("alarmList") Optional<String[]> alarmList,
//                                            @RequestParam("loadForecastListDay") Optional<String[]> loadForecastListDay,
//                                            @RequestParam("loadForecastListMonth") Optional<String[]> loadForecastListMonth,
//                                            @RequestParam("loadForecastListYear") Optional<String[]> loadForecastListYear
//                                            ) throws ArgumentErrorException, ObjectNotFoundException {
//        StationStaticData newStationStaticData = stationStaticDataService.updateStationStaticData(stationId, id.orElse(null),area.orElse(null),
//                taxes.orElse(null), ssCompNum.orElse(null), intendSsCompNum.orElse(null),
//                allOfficeNum.orElse(null), solvingEmployment.orElse(null), electromechanicalCompNum.orElse(null),
//                packingCompNum.orElse(null), materialsCompNum.orElse(null), automotiveCompNum.orElse(null),
//                foodCompNum.orElse(null), otherCompNum.orElse(null), industryNum.orElse(null),
//                compStarListMonth.orElse(null), compStarListYear.orElse(null), aouCompNumAbove3000.orElse(null),
//                aouCompNumAbove5000.orElse(null), aouCompNumAbove10000.orElse(null),
//                mediumAlarmNum.orElse(null), mediumAlarmProcessingRate.orElse(null), heaviestAlarmNum.orElse(null),
//                heaviestAlarmProcessingRate.orElse(null), waterConsumptionDay.orElse(null), waterConsumptionMonth.orElse(null),
//                waterConsumptionYear.orElse(null), waterConsumptionDayList.orElse(null),
//                waterConsumptionMonthList.orElse(null), waterConsumptionYearList.orElse(null),
//                sharpElectricityDay.orElse(null), peakElectricityDay.orElse(null),
//                flatElectricityDay.orElse(null), valleyElectricityDay.orElse(null),
//                sharpElectricityMonth.orElse(null), peakElectricityMonth.orElse(null),
//                flatElectricityMonth.orElse(null), valleyElectricityMonth.orElse(null),
//                sharpElectricityYear.orElse(null), peakElectricityYear.orElse(null),
//                flatElectricityYear.orElse(null), valleyElectricityYear.orElse(null), smartDevicesFeesDay.orElse(null),
//                materialsFeesDay.orElse(null), environmentFeesDay.orElse(null),
//                smartDevicesFeesMonth.orElse(null), materialsFeesMonth.orElse(null), environmentFeesMonth.orElse(null),
//                smartDevicesFeesYear.orElse(null), materialsFeesYear.orElse(null),
//                environmentFeesYear.orElse(null), alarmList.orElse(null), loadForecastListDay.orElse(null),
//                loadForecastListMonth.orElse(null), loadForecastListYear.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(newStationStaticData), HttpStatus.OK);
//    }
//}
